﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using dhSystemBLL.produceBLL;
using dhsystem.Main;
using baseSet.importExport;
using dhsystem.produceForm.pdrk;

namespace dhsystem.produceForm
{
    public partial class FrmPdpqb : Form
    {
       // string state;
        public FrmPdpqb()
        {
            InitializeComponent();
        }
        pdpqbBLL pdpqb = new pdpqbBLL();
        private void FrmPdpqb_Load(object sender, EventArgs e)
        {
            bindingSourcepdpqb.DataSource = pdpqb.getpdpqbAll ();
            dGridpdpqb.DataSource = bindingSourcepdpqb;
            DcolumnSet.colSet(moduleInfo.Pdpqb, dGridpdpqb);
        }
        //工具栏的编辑按钮,修改数据
        private void toolEdit_Click(object sender, EventArgs e)
        {
           // state = "编辑";
            //FrmPdpqb PdpqbAdd = new FrmPdpqb(bindingSourcepdpqb, state);
            //PdpqbAdd.ShowDialog();
        }
        //新增按钮，显示新增数据组件
        private void toolAdd_Click(object sender, EventArgs e)
        {
            FrmpiaoranPlan piaoranPlan = new FrmpiaoranPlan();
            piaoranPlan.Show();
            piaoranPlan.WindowState = FormWindowState.Maximized;
        }
        //删除按钮，删除选中行数据
        private void toolDel_Click(object sender, EventArgs e)
        {
            string billNo = dGridpdpqb.Rows[dGridpdpqb.CurrentRow.Index].Cells[1].Value.ToString();
            try
            {
                DialogResult result = MessageBox.Show("是否删除：" + billNo + "！", "提示信息", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {

                    bindingSourcepdpqb.DataSource = pdpqb.pdpqbDel (billNo);

                }
              
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
        //工具栏退出按钮，退出窗口
        private void toolExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void buttupdate_Click(object sender, EventArgs e)
        {
            bindingSourcepdpqb.DataSource = pdpqb.getpdpqbAll ();
            dGridpdpqb.DataSource = bindingSourcepdpqb;
        }
        //工具栏查询按钮，查询所有列表数据
        private void toolQuery_Click(object sender, EventArgs e)
        {
            FrmDataQuery query = new FrmDataQuery(moduleInfo.pdfpjlb );
            DialogResult result = query.ShowDialog();
            if (result == DialogResult.Yes)
            {
                dGridpdpqb.DataSource = query.rTable;
            }

        }

      
    }
}
